﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.Linq;

namespace KTX
{
    public partial class frmThongKeDienNuoc : DevExpress.XtraEditors.XtraForm
    {
        public frmThongKeDienNuoc()
        {
            InitializeComponent();
        }
        Data.QLKTXEntities db = new Data.QLKTXEntities();
        private void frmThongKeDienNuoc_Load(object sender, EventArgs e)
        {
            dayNhaBindingSource.DataSource = db.DayNha;
            dateEdit1.EditValue = DateTime.Now.AddDays(-60);
            dateEdit2.EditValue = DateTime.Now;
        }

        private void gridLookUpEdit1_EditValueChanged(object sender, EventArgs e)
        {

        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            var tu = (DateTime)dateEdit1.EditValue;
            var den = (DateTime)dateEdit2.EditValue;
            var day = (int)gridLookUpEdit1.EditValue;
            chiTietThangBindingSource.DataSource = db.ChiTietThang.Where(p => p.DienNuoc.Phong.MaNha == day && p.TuNgay > tu && p.TuNgay < den);
        }
    }
}